//
//  NSObject+Safe.m
//  vidpioneer
//
//  Created by daiyuanlin on 15-5-28.
//  Copyright (c) 2015年 tencent. All rights reserved.
//

#import "NSObject+Safe.h"

@implementation NSObject (Safe)


- (NSString *)safeDescription
{
    if ([self isKindOfClass:[NSString class]]) {
        return (NSString *)self;
    }
    return [self description];
}

- (NSString *)safeString
{
    if ([self isKindOfClass:[NSString class]]) {
        return (NSString *)self;
    }
    return @"";
}

- (NSDictionary *)safeDictionary {
    if ( [self isKindOfClass:[NSDictionary class]] ) {
        return (NSDictionary *)self;
    }
    
    return nil;
}

- (NSArray *)safeArray {
    if ( [self isKindOfClass:[NSArray class]] ) {
        return (NSArray *)self;
    }
    
    return nil;
}

@end
